package com.nlx.notes.module.core.enums;


import lombok.Getter;

public enum LoanTypeEnum {


    LOAN_TYPE_LOAN("loan","expense","renqing_jiech","借款"),

    LOAN_TYPE_REPAY("repay","income","renqingshouru_huankuan","还款"),
    ;

    @Getter
    String code;

    @Getter
    String flowType;

    @Getter
    String categoryCode;


    @Getter
    String desc;

    LoanTypeEnum(String code, String flowType, String categoryCode, String desc) {
        this.code = code;
        this.flowType = flowType;
        this.categoryCode = categoryCode;
        this.desc = desc;
    }

    public static String getFlowType(String code) {
        for (LoanTypeEnum loanTypeEnum : LoanTypeEnum.values()) {
            if (loanTypeEnum.code.equals(code)) {
                return loanTypeEnum.getFlowType();
            }
        }
        return null;
    }

    public static String getCategoryCode(String code) {
        for (LoanTypeEnum loanTypeEnum : LoanTypeEnum.values()) {
            if (loanTypeEnum.code.equals(code)) {
                return loanTypeEnum.getCategoryCode();
            }
        }
        return null;
    }





}
